| Conditions | 1 |
| Paths | 1 |
| Total Lines | 118 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | module.exports = function () { |
||
| 2 | return { |
||
| 3 | // Variables are NODE_ID and NODE_NAME (only a-z0-9\- other chars are replaced with _) |
||
| 4 | 'nodeInfos': [ |
||
| 5 | { |
||
| 6 | 'name': 'Clientstatistik', |
||
| 7 | 'href': 'https://regensburg.freifunk.net/netz/statistik/node/{NODE_ID}/', |
||
| 8 | 'image': 'https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-all-nodes?panelId=1&from=now-7d&var-nodeid={NODE_ID}&var-host={NODE_NAME}&width=650&height=350&theme=light&_t={TIME}', |
||
| 9 | 'title': 'Knoten {NODE_ID} - weiteren Statistiken' |
||
| 10 | }, |
||
| 11 | { |
||
| 12 | 'name': 'Trafficstatistik', |
||
| 13 | 'href': 'https://regensburg.freifunk.net/netz/statistik/node/{NODE_ID}/', |
||
| 14 | 'image': 'https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-all-nodes?panelId=2&from=now-7d&var-nodeid={NODE_ID}&var-host={NODE_NAME}&width=650&height=350&theme=light&_t={TIME}', |
||
| 15 | 'title': 'Knoten {NODE_ID} - weiteren Statistiken' |
||
| 16 | } |
||
| 17 | ], |
||
| 18 | 'globalInfos': [ |
||
| 19 | { |
||
| 20 | 'name': 'Statistik', |
||
| 21 | 'href': 'https://regensburg.freifunk.net/netz/statistik/', |
||
| 22 | 'image': 'https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-network-wide-stats?panelId=11&from=now-1y&width=600&height=350&theme=light', |
||
| 23 | 'title': 'Jahresstatistik - weiteren Statistiken' |
||
| 24 | } |
||
| 25 | ], |
||
| 26 | // Array of data provider are supported |
||
| 27 | 'dataPath': [ |
||
| 28 | 'https://regensburg.freifunk.net/data/' |
||
| 29 | ], |
||
| 30 | 'siteName': 'Freifunk Regensburg', |
||
| 31 | 'mapLayers': [ |
||
| 32 | { |
||
| 33 | 'name': 'Freifunk Regensburg', |
||
| 34 | // Please ask Freifunk Regensburg before using its tile server c- example with retina tiles |
||
| 35 | 'url': 'https://{s}.tiles.ffrgb.net/{z}/{x}/{y}{retina}.png', |
||
| 36 | 'config': { |
||
| 37 | 'maxZoom': 20, |
||
| 38 | 'subdomains': '1234', |
||
| 39 | 'attribution': '<a href="http://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="http://www.openstreetmap.org/about/" target="_blank">© OpenStreetMap contributors</a>', |
||
| 40 | 'start': 6 |
||
| 41 | } |
||
| 42 | }, |
||
| 43 | { |
||
| 44 | 'name': 'Freifunk Regensburg Night', |
||
| 45 | // Please ask Freifunk Regensburg before using its tile server - example with retina and dark tiles |
||
| 46 | 'url': 'https://{s}.tiles.ffrgb.net/n/{z}/{x}/{y}{retina}.png', |
||
| 47 | 'config': { |
||
| 48 | 'maxZoom': 20, |
||
| 49 | 'subdomains': '1234', |
||
| 50 | 'attribution': ' <a href="http://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="http://www.openstreetmap.org/about/" target="_blank">© OpenStreetMap contributors</a>', |
||
| 51 | 'mode': 'night', |
||
| 52 | 'start': 19, |
||
| 53 | 'end': 7 |
||
| 54 | } |
||
| 55 | }, |
||
| 56 | { |
||
| 57 | 'name': 'OpenStreetMap.HOT', |
||
| 58 | 'url': 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', |
||
| 59 | 'config': { |
||
| 60 | 'maxZoom': 19, |
||
| 61 | 'attribution': '© Openstreetmap France | © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' |
||
| 62 | } |
||
| 63 | }, |
||
| 64 | { |
||
| 65 | 'name': 'HERE', |
||
| 66 | // Please use your own API key - Free plan is on right side after the pay plans |
||
| 67 | 'url': 'https://{s}.base.maps.api.here.com/maptile/2.1/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?app_id=YOUR_KEY&app_code=YOUR_CODE&lg=deu', |
||
| 68 | 'config': { |
||
| 69 | 'attribution': 'Map © 1987-2014 <a href="http://developer.here.com">HERE</a>', |
||
| 70 | 'subdomains': '1234', |
||
| 71 | 'maxZoom': 20 |
||
| 72 | } |
||
| 73 | }, |
||
| 74 | { |
||
| 75 | 'name': 'Esri.WorldImagery', |
||
| 76 | 'url': '//server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', |
||
| 77 | 'config': { |
||
| 78 | 'maxZoom': 20, |
||
| 79 | 'attribution': 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' |
||
| 80 | } |
||
| 81 | }, |
||
| 82 | { |
||
| 83 | 'name': 'HERE.hybridDay', |
||
| 84 | // Please use your own API key - Free plan is on right side after the pay plans |
||
| 85 | 'url': 'https://{s}.aerial.maps.api.here.com/maptile/2.1/maptile/newest/{variant}/{z}/{x}/{y}/256/png8?app_id=YOUR_KEY&app_code=YOUR_CODE&lg=deu', |
||
| 86 | 'config': { |
||
| 87 | 'attribution': 'Map © 1987-2014 <a href="http://developer.here.com">HERE</a>', |
||
| 88 | 'subdomains': '1234', |
||
| 89 | 'variant': 'hybrid.day', |
||
| 90 | 'maxZoom': 20 |
||
| 91 | } |
||
| 92 | } |
||
| 93 | ], |
||
| 94 | // Set a visible frame |
||
| 95 | 'fixedCenter': [ |
||
| 96 | // Northwest |
||
| 97 | [ |
||
| 98 | 49.3522, |
||
| 99 | 11.7752 |
||
| 100 | ], |
||
| 101 | // Southeast |
||
| 102 | [ |
||
| 103 | 48.7480, |
||
| 104 | 12.8917 |
||
| 105 | ] |
||
| 106 | ], |
||
| 107 | 'siteNames': [ |
||
| 108 | { |
||
| 109 | 'site': 'ffrgb-bat15', |
||
| 110 | 'name': 'Regensburg' |
||
| 111 | }, |
||
| 112 | { |
||
| 113 | 'site': 'ffrgb', |
||
| 114 | 'name': 'Regensburg' |
||
| 115 | } |
||
| 116 | ] |
||
| 117 | }; |
||
| 118 | }; |
||
| 119 | |||
| 120 |